Ratatui in Embedded Meet Mousefood Vaishnav-Sabari-Girish ██ WHO_AM_I fn main() {
let WHO_AM_I: &str = "Vaishnav Sabari Girish";
let designation: &str = "Final Year ECE Student";
let mut interests: Vec<&str> = vec![
"Open Source",
"Embedded Systems",
"Rust",
"Linux",
"CLI/TUI"
];
let mut projects: Vec<&str> = vec![
// Rust Projects
"AlertAngel",
"ComChan (Serial Monitor)",
"Hayasen",
];
let website: &str = "https://vaishnav.world";
}
Vaishnav-Sabari-Girish 2 / 19
██ What is mousefood
1. embedded-graphics backend for ratatui
2. Enables TUI applications on embedded displays (TFT Screens, OLED Screens) 3. Works with both std and no_std targets.
Vaishnav-Sabari-Girish 3 / 19
██ The problem ▓▓▓ Traditional ratatui limitations![]()
1. Required terminal environments 2. Desktop/server focused 3. Memory footprint is high. ▓▓▓ Embedded display challenge 1. Limited character sets (ASCII Only) 2. Small screen real estate 3. Resource constraints Vaishnav-Sabari-Girish 4 / 19
██ Ratatui Architecture Vaishnav-Sabari-Girish 5 / 19
██ How mousefood solves it
1. embedded-graphics integration : Any DrawTarget can become a ratatui backend
2. Unicode font support : Uses embedded-graphics-unicodefonts for box-drawing chars
3. Simulator Mode : Develop with SDL2 before deploying on hardware.
Vaishnav-Sabari-Girish 6 / 19
██ Quick Start Code use mousefood::prelude::*;
fn main() -> Result<(), error> {
// Any embedded_graphics DrawTarget
let mut display = MyDrawTarget::new();
let backend = EmbeddedBackend::new(
&mut display,
EmbeddedBackendConfig::default()
);
let mut terminal = Terminal::new(backend)?;
loop {
terminal.draw(|frame| {
// Your Ratatui widgets here!
})?;
}
}
Vaishnav-Sabari-Girish 7 / 19
██ Outputs ▓▓▓ Simulator Output ▓▓▓ Hardware Output
Vaishnav-Sabari-Girish 8 / 19
██ Where can mousefood be used
mousefood can be used on any microcontroller that supports no_std or std Embedded Rust.
Some examples are : 1. STM32, RP2040, Nordic Microcontrollers : no_std only
2. ESP32 : Both no_std and std
Vaishnav-Sabari-Girish 9 / 19
██ Widgets supported Currently in no_std the core widgets of ratatui are supported. This includes widgets like Layout,
Block, Border, Paragraph, Gauge, List, Tabs etc.
In std environments, most third-party widgets are also supported, like tui-big-text, tui-popup
etc. Vaishnav-Sabari-Girish 10 / 19
██ Using mousefood in your Rust program
To use mousefood on actual Hardware, currently you should add the latest versions of ratatui and
mousefood to your Cargo.toml. This means that you will have to use the Alpha version of ratatui as
shown below ▓▓▓ Cargo.toml
mousefood = { git = "https://github.com/j-g00da/mousefood", rev = "
cc9f8fe372f09342537bc31a1355f77f2693d70b", default-features = false, features
= [
"fonts",
] }
ratatui = { version = "0.30.0-alpha.5", default-features = false }
Vaishnav-Sabari-Girish 11 / 19
██ Get started To get started, I have created a repository which contains basic ratatui and mousefood programs
for both Hardware (ESP32-WROOM) and Simulator (QR in next slide) This is the link https://github.com/Vaishnav-Sabari-Girish/Mousefood-Programs
This is the shortened link https://t.ly/JpDDE
You can try the programs out by cloning this repository. Vaishnav-Sabari-Girish 12 / 19
██ Repository link curl -s qrenco.de/https://t.ly/JpDDE
——————————————————— [finished] ———————————————————
█████████████████████████████████ █████████████████████████████████ ████ ▄▄▄▄▄ █ ▀▀▄ ▄ ▄██ ▄▄▄▄▄ ████ ████ █ █ ███ ▄▄▄█▄██ █ █ ████ ████ █▄▄▄█ █ ▄▄ █▀▄▄██ █▄▄▄█ ████ ████▄▄▄▄▄▄▄█ █ ▀ █▄█ █▄▄▄▄▄▄▄████ ████▄ ▀█▄▄▀▄ ██ ▄▄ ▄ ▄▄▀█ ████ █████▀▀▀▄ ▄▄▄▀█▄█▀█▄▄█▀ ▄ ▄█▄████ ████▄▄ ▀▀█▄██ █▄ ▄█ ▀█ ▀███▀ ████ ████▄▄▄█▀█▄ ▀ ▀ ▄ ▄██▀▀ ▄█▄████ ████▄▄█▄▄▄▄█ ▀██ █ ▄▄▄ ██▄▀████ ████ ▄▄▄▄▄ █▀██▄█▀█ █▄█ ██▀ ████ ████ █ █ ██ ▄ ▄█ ▄▄ █▀ ▄████ ████ █▄▄▄█ █ ▄▄▀ ▄ █▀█▀ ▄█▄▄████ ████▄▄▄▄▄▄▄█▄▄▄██▄▄▄▄█▄██▄██▄████ █████████████████████████████████ █████████████████████████████████ Vaishnav-Sabari-Girish 13 / 19
██ Projects that use mousefood (Notable ones)
1. Orhun Parmaksiz's (The legend himself) Tuitar : https://github.com/orhun/tuitar
2. Mnyaoo32 (ESP32 IRC client) : https://github.com/intuis/mnyaoo32
3. Phone-OS (ESp32-CYD) : https://github.com/Julien-cpsn/Phone-OS
Vaishnav-Sabari-Girish 14 / 19
██ My personal project (Using mousefood, ratatui and std)
I am currently working on AlertAngel, a elderly monitoring system.
It uses the following tech stack : ▓▓▓ Hardware 1. Glyph C3 (ESP32-C3) 2. 2.4" TFT display (ILI9341) 3. Sensors (MPU9250, MAX30102, DS18B20) 4. Touch sensors ▓▓▓ Firmware 1. std Embedded Rust
▒▒▒▒ Crates I am using (Some of them) 1. ratatui and mousefood for the UI on the screen
2. mipidsi for the display driver
3. esp_idf_svc for std support on ESP32
For more information visit https://github.com/AlertAngel
Vaishnav-Sabari-Girish 15 / 19
██ Inspiration The inspiration for the ID card form factor of AlertAngel came from the GitHub Universe badges
which are unique. They have a microcontroller which you can program and display whatever you want in the screen of the ID card. Below is the image of a GitHub Universe ID card (Image Credit : Martin Woodward, via : X)
Vaishnav-Sabari-Girish 16 / 19
██ Some images